# -*- codeing = utf-8 -*-

import hashlib
from django.conf import settings
import uuid

def md5(password):
    """MD5加盐"""
    hash_obj = hashlib.md5(settings.SECRET_KEY.encode('utf-8'))     #预加盐处理
    hash_obj.update(password.encode('utf-8'))
    return hash_obj.hexdigest()

def uid(string):
    data = "{}-{}".format(str(uuid.uuid4()),string)
    return md5(data)
